Skip to contentSkip to conversation

UE4 4.17 causes hang in amdgpu_cs_query_fence_status

Bug 101977 [email protected] 1 participant 19 messages Jul 31, 2017 – Aug 13, 2017

lore
Share & tools
lore
#0 lore raw

https://bugs.freedesktop.org/show_bug.cgi?id=101977

Bug ID: 101977
Summary: UE4 4.17 causes hang in amdgpu_cs_query_fence_status
Product: Mesa
Version: git
Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
Severity: normal
Priority: medium
Component: Drivers/Gallium/radeonsi
Assignee: [email protected]
Reporter: [email protected]
QA Contact: [email protected]

Created attachment 133142
--> https://bugs.freedesktop.org/attachment.cgi?id=133142&action=edit
backtrace and dmesg

Ubuntu 16.04.2 LTS x86_64
kernel 4.12.4-041204-generic
Latest mesa git as of today 07/30
Latest UE4 4.17 out git branch as of today (4.17 not officially released yet) clang 3.9 3.9.1-4ubuntu3~16.04.1 (tags/RELEASE_391/rc2) (used for mesa and UE4)

Starting the editor, or starting directly on a game, either in gl3 or gl4 mode causes a hang. You have to use -NOSPLASH to avoid another, unrelated issue. My typical command line looks like this:

UnrealEngine> set ver 3.9 ; env LD_LIBRARY_PATH=$HOME/usr/lib:/usr/lib/llvm-$ver/lib LIBGL_DRIVERS_PATH=$HOME/usr/lib/dri:/usr/lib/i386-linux-gnu/dri LIBGL_DEBUG=verbose VK_ICD_FILENAMES=/opt/Valve/mesa/src/amd/vulkan/dev_icd.json ./Engine/Binaries/Linux/UE4Editor-Linux-Debug -opengl4 -NOSPLASH

For GL3, pass -opengl3 on the command line and set env var MESA_GL_VERSION_OVERRIDE=3.2 (results are the same)

Attaching backtrace and dmesg

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw

[Bug 101977] UE4 4.17 causes Assertion `G_0286CC_LINEAR_CENTER_ENA(shader->config.spi_ps_input_addr)' failed

https://bugs.freedesktop.org/show_bug.cgi?id=101977

Timothee Besset <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

            Summary|UE4 4.17 causes hang in     |UE4 4.17 causes Assertion
                   |amdgpu_cs_query_fence_statu |`G_0286CC_LINEAR_CENTER_ENA
                   |s                           |(shader->config.spi_ps_inpu
                   |                            |t_addr)' failed

--- Comment #1 from Timothee Besset <[email protected]> --- Default/release config drivers will cause a system hang. Debug drivers will cause an assert:

si_shader.c:7417: _Bool si_shader_select_ps_parts(struct si_screen *, LLVMTargetMachineRef, struct si_shader *, struct pipe_debug_callback *):
Assertion `G_0286CC_LINEAR_CENTER_ENA(shader->config.spi_ps_input_addr)' failed.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw

[Bug 101977] UE4 4.17 causes Assertion `G_0286CC_LINEAR_CENTER_ENA(shader->config.spi_ps_input_addr)' failed

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=101977

--- Comment #2 from Timothee Besset <[email protected]> --- hakzsam on irc was able to reproduce the issue on his system. also to note, hakzam uses a different LLVM version than I do.

problem does not reproduce with nouveau driver, only radeonsi

ran with MESA_GLSL=dump R600_DEBUG=ps,vs,tcs,tes,cs,gs to extract more information:

https://gist.github.com/TTimo/4f08718e1c5d9de003d617e3f0daea2a

after debugging some more, to the best of my understanding, the assertion happens against the config of 'shader 3'
(https://gist.github.com/TTimo/4f08718e1c5d9de003d617e3f0daea2a#file-gistfile1-txt-L411)

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

[Bug 101977] UE4 4.17 causes Assertion `G_0286CC_LINEAR_CENTER_ENA(shader->config.spi_ps_input_addr)' failed

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=101977

--- Comment #3 from Timothee Besset <[email protected]> --- Created attachment 133372
--> https://bugs.freedesktop.org/attachment.cgi?id=133372&action=edit
apitrace

Stepped through and commented out code until I could narrow down the last GL call that leads to a crash. Captured an apitrace up until the call that will ultimately cause the problem.

https://gist.github.com/TTimo/05222bd524b534977c5e72bcb3df3dfc

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw

[Bug 101977] UE4 4.17 causes Assertion `G_0286CC_LINEAR_CENTER_ENA(shader->config.spi_ps_input_addr)' failed

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=101977

--- Comment #4 from Timothee Besset <[email protected]> --- Created attachment 133373
--> https://bugs.freedesktop.org/attachment.cgi?id=133373&action=edit
apitrace FBlackCubeArrayTexture::InitRHI

Another trace: same crash, but initializing a different resource (FBlackCubeArrayTexture::InitRHI).

The skipped call triggering the crash:

TexSubImage3D #2: target = 36873 level = 0 xoffset = 0 yoffset = 0 zoffset = 0 width = 1 height = 1 depth = 1 format = 32993 type = 33639 pixels = 0

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw

[Bug 101977] UE4 4.17 causes Assertion `G_0286CC_LINEAR_CENTER_ENA(shader->config.spi_ps_input_addr)' failed

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=101977

--- Comment #5 from Marek Olšák <[email protected]> ---
This can't be reproduce with LLVM 6.0svn and Radeon Fury. Trying LLVM 3.9...

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw

[Bug 101977] UE4 4.17 causes Assertion `G_0286CC_LINEAR_CENTER_ENA(shader->config.spi_ps_input_addr)' failed

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=101977

--- Comment #6 from Samuel Pitoiset <[email protected]> --- The issue can't be reproduced with the traces here as well. But if you build the UE4 editor from github, the issue can be reproduced with LLVM6.0svn.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw

[Bug 101977] UE4 4.17 causes Assertion `G_0286CC_LINEAR_CENTER_ENA(shader->config.spi_ps_input_addr)' failed

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=101977

--- Comment #7 from Marek Olšák <[email protected]> --- Does the issue occur with any of these:

R600_DEBUG=mono
R600_DEBUG=nooptvariant

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#8 lore raw

[Bug 101977] UE4 4.17 causes Assertion `G_0286CC_LINEAR_CENTER_ENA(shader->config.spi_ps_input_addr)' failed

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=101977

--- Comment #8 from Samuel Pitoiset <[email protected]> --- Yes for both.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#9 lore raw

[Bug 101977] UE4 4.17 causes Assertion `G_0286CC_LINEAR_CENTER_ENA(shader->config.spi_ps_input_addr)' failed

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=101977

--- Comment #9 from Timothee Besset <[email protected]> --- (In reply to Samuel Pitoiset from comment #6)

Quoted 2 lines

The issue can't be reproduced with the traces here as well. But if you build the UE4 editor from github, the issue can be reproduced with LLVM6.0svn.

Have you modified the traces to include the call that triggers the crash? The traces I uploaded only recorded the GL calls up to the last call before the crash is triggered, so unless you know how to manually add a call, they won't cause a crash.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#10 lore raw

[Bug 101977] UE4 4.17 causes Assertion `G_0286CC_LINEAR_CENTER_ENA(shader->config.spi_ps_input_addr)' failed

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=101977

--- Comment #10 from Timothee Besset <[email protected]> --- A similar crash happens if UE4 is started in Vulkan mode:

https://gist.github.com/TTimo/28fa434142fb59e66ae469ed7f7ef034

SIGFPE happens because pipeline->shaders[4]->config.num_vgprs == 0, which is consistent with the empty config reads from the LLVM shader compilation

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#11 lore raw

[Bug 101977] UE4 4.17 causes Assertion `G_0286CC_LINEAR_CENTER_ENA(shader->config.spi_ps_input_addr)' failed

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=101977

--- Comment #11 from Marek Olšák <[email protected]> ---
Samuel, can you share here what you found out when you were looking into the issue? Thanks.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#12 lore raw

[Bug 101977] UE4 4.17 causes Assertion `G_0286CC_LINEAR_CENTER_ENA(shader->config.spi_ps_input_addr)' failed

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=101977

--- Comment #12 from Marek Olšák <[email protected]> --- .AMDGPU.config coming from LLVM is empty with UE4Editor. This assertion fails:

src/amd/common/ac_binary.c +1 -0
index 618b5cf..2fbb575 100644
@@ -148,6 +148,7 @@ void ac_elf_read(const char *elf_data, unsigned elf_size,
                } else if (!strcmp(name, ".AMDGPU.config")) {
                        section_data = elf_getdata(section, section_data);
                        binary->config_size = section_data->d_size;
+                       assert(binary->config_size);
                        binary->config = MALLOC(binary->config_size *
sizeof(unsigned char));
                        memcpy(binary->config, section_data->d_buf,
binary->config_size);
                } else if (!strcmp(name, ".AMDGPU.disasm")) {

Any ideas?

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#13 lore raw

[Bug 101977] UE4 4.17 causes Assertion `G_0286CC_LINEAR_CENTER_ENA(shader->config.spi_ps_input_addr)' failed

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=101977

--- Comment #13 from Dave Airlie <[email protected]> --- llvm seems fine, it seems to be libelf that is broken.

I've noticed UE4 exports it's own libelf symbols but I haven't determined that is the problem yet.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#14 lore raw

[Bug 101977] UE4 4.17 causes Assertion `G_0286CC_LINEAR_CENTER_ENA(shader->config.spi_ps_input_addr)' failed

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=101977

--- Comment #14 from Dave Airlie <[email protected]> --- Yup once I hid the libelf symbols, it all works.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#15 lore raw

[Bug 101977] UE4 4.17 causes Assertion `G_0286CC_LINEAR_CENTER_ENA(shader->config.spi_ps_input_addr)' failed

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=101977

Marek Olšák <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

         Resolution|---                         |NOTOURBUG
             Status|NEW                         |RESOLVED

--- Comment #15 from Marek Olšák <[email protected]> --- Interesting. So it's a UE4 bug after all. If UE4 didn't export its own libelf functions, it would work.

When the driver is loaded, the dynamic linker loads libelf, but since UE4 exports the same function names as libelf does, libelf functions are not loaded at all and the functions from UE4 are exposed to the driver instead. The driver, thinking it's calling libelf, is actually invoking the UE4 functions of the same name.

A temporary workaround is to load the system libelf first by doing:

LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libelf.so ./UE4Editor

It will have the opposite effect. UE4 will use system libelf instead of its own, because the symbols conflict and the system one is loaded first.

This bug should be fixed in UE4 though.

I'm closing this bug, because there is nothing Mesa can do here.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#16 lore raw

[Bug 101977] UE4 4.17 causes Assertion `G_0286CC_LINEAR_CENTER_ENA(shader->config.spi_ps_input_addr)' failed

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=101977

--- Comment #16 from Timothee Besset <[email protected]> --- Thanks for the help and thorough investigation! I will follow up from there with Epic to get this addressed UE4 side.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#17 lore raw

[Bug 101977] UE4 4.17 causes Assertion `G_0286CC_LINEAR_CENTER_ENA(shader->config.spi_ps_input_addr)' failed

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=101977

--- Comment #17 from Dave Airlie <[email protected]> --- Enabling the UE4 linker script fixes this also. (It got disabled for 4.17).

It appears that versions the symbols on the UE side.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#18 lore raw

[Bug 101977] UE4 4.17 causes Assertion `G_0286CC_LINEAR_CENTER_ENA(shader->config.spi_ps_input_addr)' failed

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=101977

--- Comment #18 from Timothee Besset <[email protected]> ---
https://github.com/EpicGames/UnrealEngine/pull/3901

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel